package org.yang.plugins.resource.exception;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.springframework.http.HttpStatus;
import org.yang.plugins.resource.serializer.Auth2ExceptionSerializer;

/**
 * 未授权
 * @author: lslands
 * @version: v2.0
 * @create: 2021/6/14 22:33
 **/
@JsonSerialize(using = Auth2ExceptionSerializer.class)
public class UnauthorizedException extends Auth2Exception{

    public UnauthorizedException(String msg) {
        super(msg);
    }

    @Override
    public String getOAuth2ErrorCode() {
        return "unauthorized";
    }

    @Override
    public int getHttpErrorCode() {
        return HttpStatus.UNAUTHORIZED.value();
    }
}

